package businessServer;

import dbServer.db.Contact;
import dbServer.dao.ContactDAO;

import java.util.List;

public class ContactManager {
    private ContactDAO contactDAO;

    public ContactManager() {
        contactDAO = new ContactDAO();
    }

    public void addContact(String name, String phone, String address) {
        Contact contact = new Contact(name, phone, address);
        contactDAO.addContact(contact);
    }

    public void editContact(String name, String newPhone, String newAddress) {
        Contact contact = new Contact(name, newPhone, newAddress);
        contactDAO.updateContact(contact);
    }

    public void deleteContact(String name) {
        contactDAO.deleteContact(name);
    }

    public List<Contact> getAllContacts() {
        return contactDAO.getAllContacts();
    }
}
